<script setup>
import { useRouter } from 'vue-router'
import { setToken, getToken } from '../utils/auth'
const router = useRouter()

const setToken_ = () => {
  setToken()
}
const getToken_ = () => {
  const token = getToken()
  console.log(token);
}
</script>
<template>
  <div>
    <a href="https://vitejs.dev" target="_blank">
      <img src="/vite.svg" class="logo" alt="Vite logo" />
    </a>
    <a href="https://vuejs.org/" target="_blank">
      <img src="../assets/vue.svg" class="logo vue" alt="Vue logo" />
    </a>
    <p>
      我是主应用页面
    </p>
    <button @click="router.push('/vitesub1')">去子应用页面1</button>
    <br>
    <button style="margin-top: 10px;" @click="router.push('/vitesub2')">去子应用页面2</button>
    <div style="margin-top: 10px;">
      <button @click="setToken_">设置Token</button>
      <button style="margin-left: 10px;" @click="getToken_">获取Token</button>
    </div>
  </div>
</template>

<style scoped>
.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}

.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}

.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
